package org.atlantis.grosbeak.depot.proxy.value;

import org.atlantis.grosbeak.depot.DepotMaker;
import org.atlantis.grosbeak.depot.desc.ObjectDesc;
import org.atlantis.grosbeak.depot.proxy.ObjectProxy;
import org.atlantis.grosbeak.depot.proxy.ValueProxy;

/**
 * 匿名内部类值代理。在配置文件中的格式应该是：“{type:'xxx', fields:{name:
 * 'xxx'}}”，获得的是一个类型为“xxx”，并使用fields中的信息填充后的对象。
 * 
 * @author <a href="mailto:seenoevil.cn@gmail.com">SeeNoEvil</a>
 * 
 */
public class InnerValueProxy implements ValueProxy {

	private ObjectDesc od;

	public InnerValueProxy(ObjectDesc od) {
		this.od = od;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.atlantis.grosbeak.depot.proxy.ValueProxy#get(org.atlantis.grosbeak
	 * .depot.DepotMaker)
	 */
	public Object get(DepotMaker maker) {
		DepotMaker dm = maker.clone(null);
		ObjectProxy op = dm.getObjMaker().make(dm, od);
		return op.get(od.getType(), maker);
	}
}
